package com.neusoft.dibuy.partitioner;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class PhoneprePartitioner extends Partitioner<Text, FlowBean> {
    @Override
    public int getPartition(Text text, FlowBean flowBean, int numPartitions) {
        String prePhone = text.toString().substring(0, 3);
        switch (prePhone) {
            case "135":
                return 0;
            case "136":
                return 1;
            case "137":
                return 2;
            case "138":
                return 3;
            default:
                return 4;
        }
    }
}
